﻿using System;
using System.Windows.Forms;
using HighDiveEngine.Aggregates;
using HighDiveEngine.Model;
using HighDiveEngine.Resources;

namespace HighDiveAdmin.GUI
{
    public enum FormPanels
    {
        Welcome,
        Running,
        Editview
    }

    public interface IFormMain
    {
        event DelegateVoidNullableInt EventEditRunningDive;
        event MethodInvoker EventLoadWelcomeScreen;
        event MethodInvoker EventLoadEditScreen;
        event MethodInvoker EventLoadEditScreenNewContest;
        event DelegateVoidNullableInt EventLoadRunningScreen;
        event MethodInvoker EventSelectContestToRun;
        event DelegateVoidContest EventLoadContestToEdit;
        event DelegateVoidDoubleInt EventManualScoreEntry;
        event DelegateVoidString EventLoadDiver;
        event DelegateVoidString EventEditContestLoadJudge;
        event DelegateVoidContestEventArgs EventSaveContest;
        event DelegateVoidContestEventArgs EventSaveAndStartContest;
        //event DelegateContestInformation EventUpdateContestInformation;
        event DelegateNewJudge EventNewJudge;
        event DelegateNewJudge EventUpdateJudge;
        event DelegateVoidInt EventSetNumberOfJudges;
        event DelegateVoidJudgeEventArgs EventSaveJudge;
        event DelegateVoidBool EventStartContest;
        event MethodInvoker EventEndContest;
        event DelegateVoidStringInt EventUpdateActiveJudge;
        event DelegateDoubleStringInt EventCalculateDiveDifficulty;
        event DelegateVoidDiveEventArgs EventSaveEditedDive;
        event DelegateDiveListDiver EventEditContestLoadDiveList;
        event DelegateVoidInt EventEditContestAddDiver;
        event DelegateVoidPersonEventArgsDiveEventArgsArray EventEditContestSaveDiver;
        event DelegateVoidString EventEditContestEditDiver;
        event MethodInvoker EventDiscardContest;
        event DelegateJudgeInt EventEditContestAddEditJudge;
        event DelegateDiverEventArgs EventRemoveDiver;
        event DelegateDiveEventArgs EventRemoveDive;

        FormPanels ActivePanel { get; set; }

        void FillEditContestScreenWithContest(Contest contest, PersonList personList);
        void FillWelcomeScreenUpcomingContests(ContestList upcomingList);
        void FillEditContestScreenContestList(ContestList contestHistoryList);
        void FillRunningContestDiveQueue(DiveList diveQueueList);
        void FillRunningContestDiveResults(DiveList diveResults);
        void FillRunningContestActiveDive(Dive dive);
        void FillRunningContestJudgeScore(DiveScore score);
        void SetRunningContestNumVisibleJudges(JudgeList judgeList);
        void FillEditContestExistingDiverFromIdNumber(Person person);
        void FillRunningContestDiveHistory(DiveList diveHistory);
        void ShowWelcomeScreenStartContestList(ContestList contestList);
        void ShowWelcomeScreenNoContestsLoadedError();
        void ShowRunningContestConnectionPhase(JudgeList judgeList, string adminIp);
        void UpdateRunningContestJudgeConnectionStatus(Judge judge);
        void HideRunningContestConnectionPhase();
        Object Invoke(Delegate method, params Object[] args);
        void FillEditContestExistingJudgeFromIdNumber(Person person);
        void ShowRunningContestSaveContestProgress();
        void CloseRunningContestSaveContestProgress();

        void ShowEditContestNewJudgePanel(Judge judge, int textBoxNumber);
        void ShowRunningContestCompletedPanel();

        void UpdateContestList(ContestList contestList);

        void ShowEditContestJudgesPanel(JudgeList judgeList);

        void ShowEditContestDiverTreeView(DiveList diveList);

        void FillEditContestNewDiverPanel(Diver diver, DiveList diveList);

        void FillEditContestNewJudgePanel(Judge judge);

        void UpdatePersonLists(PersonList personList);

        void UpdateJudgeScoreInHistory(Dive dive);
    }
}
